﻿using System.Linq.Expressions;
using SqlSugar;

namespace WeDonekRpc.SqlSugar
{
    public interface IRepository
    {
        SqlSugarProvider Provider { get; }

        int ExecuteSql ( string sql, params SugarParameter[] param );

        bool IsTable ( string tableName );
        Result[] Gets<Result> ( string sql, params SugarParameter[] param ) where Result : class, new();
        Result[] Gets<Result> ( ISugarQueryable<Result>[] list, string orderBy ) where Result : class, new();
        Result[] Gets<Result> ( ISugarQueryable<Result>[] list ) where Result : class, new();
        Result[] Gets<Table, Result> ( ISugarQueryable<Table>[] list, Expression<Func<Table, Result>> selector, string orderBy ) where Table : class, new();
        Result[] Gets<Table, Result> ( ISugarQueryable<Table>[] list ) where Table : class, new() where Result : class;
        Result[] Gets<Table, Result> ( ISugarQueryable<Table>[] list, Expression<Func<Table, Result>> selector ) where Table : class, new();

        Result Get<Result> ( ISugarQueryable<Result>[] list, string orderBy ) where Result : class, new();

        Result Get<Table, Result> ( ISugarQueryable<Table>[] list, Expression<Func<Table, Result>> selector, string orderBy ) where Table : class, new();


        Result ExecuteSql<Result> ( string sql, params SugarParameter[] param ) where Result : class;
    }
}